
package ui;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.JPanel;

/**
 * BackgroundPanel paints a background image to a panel. Components can Overlay
 * that background by adding them to this panel.
 * 
 * @author Jiminikiz
 */

public class BackgroundPanel extends JPanel
{
    String imageFilePath;
    
    public BackgroundPanel(String filePath)
    {
	super();
	imageFilePath = filePath;
    }
    
    private static final long serialVersionUID = -2486533876490940921L;
    
    public void paintComponent(Graphics g)
    {
	Image a = Toolkit.getDefaultToolkit().getImage(imageFilePath);
	g.drawImage(a, 0, 0, getSize().width, getSize().height, this);
    }
}
